authApp.value('page','material_money'); 
authApp.controller("authMoneyDataController",function($scope,$http,$cookies,$getQueryString){
	if($getQueryString("isfill")=="2"){
		$scope.schoolId=$getQueryString("schoolId");
		$scope.isHideAction=true;
	}
	$scope.savaInfo=function(type){
		var confirmHtml="是否保存";
		if(type=="sub"){
			confirmHtml="是否提交";
		}
		if(window.confirm(confirmHtml)){
			var methodUrl=apis.insertMoneyResource;
			var methodStatus="0";
			var alertMsg="保存成功";
			if($getQueryString("isfill")=="1"){
				methodUrl=apis.updateMoneyResourceData;
			}else if($getQueryString("isfill")=="0"){
				methodUrl=apis.insertMoneyResource;
			}else{
				$scope.isHideAction=true;
			}
			if(type=="su"){
				methodStatus="0";
				alertMsg="保存成功";
			}else if(type=="sub"){
				methodStatus="1";
				alertMsg="提交成功";
			}
			$http({
				method:'post',
				url:methodUrl,
				data:{
					'trainingFunds':$scope.trainingFunds,
					'professionalTrainingFunds':$scope.professionalTrainingFunds,
					'budgetStandards':$scope.budgetStandards,
					'wereBorn':$scope.wereBorn,
					'averageEducationFundingRatio':$scope.averageEducationFundingRatio,
					'outlayPerStudent':$scope.outlayPerStudent,
					'equipmentInvestment':$scope.equipmentInvestment,
					'professionalLibraryFunding':$scope.professionalLibraryFunding,
					'fundingEducationFundingPer':$scope.fundingEducationFundingPer,
					'status':methodStatus,
					'remark1':$scope.remark1,
					'remark2':$scope.remark2,
					'remark3':$scope.remark3,
					'remark4':$scope.remark4,
					'remark5':$scope.remark5,
					'remark6':$scope.remark6,
					'remark7':$scope.remark7,
					'remark8':$scope.remark8,
					'remark9':$scope.remark9,
				},
			}).success(function(response){
				if(response.code=="000000"){
					alert(alertMsg);
					location.href="../datafill.html";
				}else{
					alert(response.errorMsg);
				}
				$scope.judeAllList=response.data;
			})
		}
	}
	$scope.getInfo=function(){
		//alert("xxxxxxxxxxxxxx");
			$http({
				method:'get',
				url:apis.queryMoneyResourceDataBySchoolId1,
				params:{'schoolid':$scope.schoolId},
			}).success(function(response){
				if(response.code=="000000"){
					$scope.trainingFunds=response.data.trainingFunds;
					$scope.professionalTrainingFunds=response.data.professionalTrainingFunds;
					$scope.budgetStandards=response.data.budgetStandards;
					$scope.wereBorn=response.data.wereBorn;
					$scope.averageEducationFundingRatio=response.data.averageEducationFundingRatio;
					$scope.outlayPerStudent=response.data.outlayPerStudent;
					$scope.equipmentInvestment=response.data.equipmentInvestment;
					$scope.professionalLibraryFunding=response.data.professionalLibraryFunding;
					$scope.fundingEducationFundingPer=response.data.fundingEducationFundingPer;
					$scope.remark1=response.data.remark.split("#")[0];
					$scope.remark2=response.data.remark.split("#")[1];
					$scope.remark3=response.data.remark.split("#")[2];
					$scope.remark4=response.data.remark.split("#")[3];
					$scope.remark5=response.data.remark.split("#")[4];
					$scope.remark6=response.data.remark.split("#")[5];
					$scope.remark7=response.data.remark.split("#")[6];
					$scope.remark8=response.data.remark.split("#")[7];
					$scope.remark9=response.data.remark.split("#")[8];
				}
			})
		
	}
	if($getQueryString("isfill")=="1"||$getQueryString("isfill")=="2"){
		$scope.getInfo();
	}
})